package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class FindOperation implements Ioperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("查找书籍");
        System.out.println("请输入你要找的书名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        int currunt = bookList.getNum();

        for (int i = 0; i < currunt; i++) {
           Book book = bookList.getBooks(i);
           if(book.getName().equals(name)){
               System.out.println(book);
               return;
           }
        }
        System.out.println("没找到");
    }
}
